home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 14 / CU Amiga Magazine's Super CD-ROM 14 (1997)(EMAP Images)(GB)(Track 1 of 3)[!][issue 1997-09].iso / CUCD / Programming / GMS / Source / E / Fireworks / LList.e < prev    next >
Encoding:
Text File  |  1992-09-02  |  693 b   |  48 lines

  1. /*
  2.  *  Generic Inherited list module, written by Richard Clark
  3.  */
  4.  
  5. OPT MODULE
  6. OPT EXPORT
  7.  
  8.  
  9. OBJECT node
  10.   next:PTR TO node
  11.   prev:PTR TO node
  12. ENDOBJECT
  13.  
  14. PROC del() OF node
  15. /*
  16.  *  detaches current node, patching up links in list.
  17.  */
  18.  
  19.   IF self.next<>NIL THEN self.next.prev:=self.prev
  20.   IF self.prev<>NIL THEN self.prev.next:=self.next
  21.  
  22. ENDPROC
  23.  
  24. PROC del_list() OF node
  25. /*
  26.  *  Sets off a chain of destruction that ENDs every node in the list.
  27.  */
  28.  
  29.   IF self.next THEN self.next.del_list()
  30.  
  31.   END self
  32.  
  33. ENDPROC
  34.  
  35. PROC add(nde:PTR TO node) OF node
  36. /*
  37.  *  Adds a node to the end of the list
  38.  */
  39.  
  40.   IF self.next
  41.     self.next.add(nde) 
  42.   ELSE
  43.     self.next:=nde
  44.     nde.prev:=self
  45.   ENDIF
  46.  
  47. ENDPROC
  48.